package co.edu.eam.ingsoft.jpa.impl;

import java.util.GregorianCalendar;

import co.edu.eam.ingsoft.jpa.reflect.EntityManagerImpl;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		EntityManagerImpl manager = new EntityManagerImpl(Persona.class);

		for (int i = 1; i <= 100; i++) {
			manager.persist(new Persona(String.valueOf(i), "persona" + i,
					new GregorianCalendar(i + 1900, i, i).getTime()));
		}

		for (int i = 1; i <= 50; i++) {
			manager.merge(new Persona(String.valueOf(i), "Persona" + i,
					new GregorianCalendar(i + 1900, i, i).getTime()));
		}

		for (int i = 51; i <= 100; i++) {
			manager.remove(new Persona(String.valueOf(i), null, null));
		}

		// for (int i = 1; i <= 100; i++) {
		// Persona persona = manager.find(Persona.class, String.valueOf(i));
		// System.out.println(persona.getCedula() + "," + persona.getNombre()
		// + "," + persona.getFechaNacimiento());
		// }

	}
}
